{include file="/common/_meta"}
</head>
<body>
{include file="/common/top"}

<div class="main-container container-fluid">
    <div class="page-container">
        <!-- Page Sidebar -->
       {include file="/common/list"}
        <!-- Page Content -->
        <div class="page-content">

            <!-- Page Breadcrumb -->
            <div class="page-breadcrumbs">
                <ul class="breadcrumb">
                   <li>
                        <a href="#">系统</a>
                    </li>
                    <li>
                        <a href="{:url('article/lst')}">图片管理</a>
                    </li>
                    <li class="active">添加图片</li>
                </ul>
            </div>
            <!-- /Page Breadcrumb -->

            <!-- Page Body -->
            <div class="page-body">

                <button type="submit" tooltip="添加文章" class="btn btn-sm btn-azure btn-addon"> 批量删除
                </button>
                <div class="row">
                    <div class="col-lg-12 col-sm-12 col-xs-12">
                        <div class="widget">
                            <div class="widget-body">
                                <div class="flip-scroll">
                                    <table class="table table-bordered table-hover">
                                        <thead class="">
                                            <tr>
                                                <th>ID</th>
                                                <th>状态</th>
                                            </tr>
                                        </thead>
                                        {volist name="imglist" id="img"}
                                        <tbody>
                                            <tr>
                                                <td><img src="{$img}" height="50"></td>
                                                <td>
                                                    <a href="#" onclick="return delimg(this);" id="{$img}" class="btn btn-danger btn-sm shiny">
                                                        <i class="fa fa-trash-o"></i> 删除
                                                    </a>
                                                </td>
                                            </tr>
                                        </tbody>
                                        {/volist}
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <!-- /Page Body -->
        </div>
        <!-- /Page Content -->
	</div>
</div>

{include file="common/_footer"}

<script>
    function delimg(a){
        if (!confirm('ok不？')) {
            return false;
        }
        var url = "{:url('delimg')}";
        var imgsrc = $(a).attr('id');
        alert(imgsrc);
        $.ajax({
            url:url,
            type:"post",
            dateType:"json",
            data:{imgsrc:imgsrc},
            success:function(data){
                if (data==1) {
                    $(a).parent().parent().remove();
                    alert('删除图片成功！');
                }else if (data==2) {
                    alert('删除图片失败！');
                }else{
                    alert('图片不存在！');
                }
            }
        });
    }
</script>
</body>
</html>